<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <g:set var="entityName" value="${message(code: 'inscricao.label', default: 'Inscricao')}" />
  <title>|</title>
 
  <script type="text/JavaScript">
function mostra() { 
document.getElementById("imgAjax").style.display = 'block';
}
  </script>
  <g:javascript library="application" />
  <style type="text/css" >
    .spacer {
      height: 13px;
    }
    p {text-align: justify;
    }
    input.green{
      background: green;color: #ffffff;
    }
  </style>
</head>
<body>    
<g:ifAnyGranted role="ROLE_ADMIN,ROLE_USER_SUPER,ROLE_REVISOR,ROLE_GESTOR" >
  <div id ="corpo${indexador}" >
    <div class="body" id="corpo" style="border: solid 0.02em ; "  >
      <br>
      <div class="col_1">
        <button onClick="${remoteFunction(controller:'inscricao',action:'blank', update:[success:'corpo' +indexador] )}"  style="background-color: green;color :white" >Retornar</button>
      </div>
      <br>
      <br>
      <div class="col_8" style="width: 400px;">
        INSCRI&Ccedil;&Atilde;O N&ordm;:${inscricaoInstance?.inscricao}
        <br>
        ESTABELECIMENTO : ${inscricaoInstance?.razaoSocial}
            <br>
        CNES:${inscricaoInstance?.cnes}
            <br>
        CNPJ:${inscricaoInstance?.cnpj} 
        <br>
        MODALIDADE DE ATENDIMENTO : ${inscricaoInstance?.modalidadeAtendimento}

        <g:ifAnyGranted role="ROLE_ADMIN,ROLE_GESTOR" >
      
        <br>
        RESPONS&Aacute;VEL:${inscricaoInstance?.usuario?.userRealName}
        <br>
        E-MAIL : ${inscricaoInstance?.usuario?.email}
        <br>
        </g:ifAnyGranted>
      </div>
      <input id="total" type="hidden" value="${total}">
      <input id="statusOld" type="hidden" value="Aguardando analise dos documentos">
      <br>
      <g:formRemote name="myForm" update="status${indexador}"  onLoading  ="${remoteFunction(controller:'inscricao',action:'mailRender', update:[success:'email'+indexador] )}"   onSuccess  ="${remoteFunction(controller:'inscricao',action:'blank', update:[success:'corpo' +indexador] )}"  on619 ="alert('teste')"  onFailure ="alert('Erro Registro Não Pode Ser Efetuado!')"
                    url="[ controller: 'inscricao', action: 'ajaxUpdate']">
        <br>
        <div style="height: 10px"></div><!-- end .spacer -->
        <br>
        <br>
        <br>
        <br>
         <br>
        <a>Ultima Atualiza&ccedil;&atilde;o: <g:formatDate format="dd/MM/yyyy" date="${inscricaoInstanceAcompanhamento?.dataDeCadastro}"/> &nbsp;As : <g:formatDate date="${inscricaoInstanceAcompanhamento?.dataDeCadastro}" type="time" style="SHORT"/>
          <br>${inscricaoInstanceAcompanhamento.usuario ? 'Por: ' + Usuario.findById(inscricaoInstanceAcompanhamento.usuario)  : ''}
          <br>
          Numero de Atualiza&ccedil;&otilde;es: ${InscricaoAcompanhamento.countByInscricao(inscricaoInstance)- 1}
        </a>
        <input type="hidden" name="inscricao.id" value="${inscricaoInstance?.id}" />
        <input type="hidden" name="usuario.id" value="${usuario.id}" />
        <div class="spacer" ></div><!-- end .spacer -->
        <fieldset><legend>Status:</legend>
          <div class="row">
${InscricaoAcompanhamento.situacao(inscricaoInstanceAcompanhamento?.status )}
          </div>
        </fieldset>
        <fieldset><legend>Documentos Entregues :</legend>
          <table class="datagrid">
            <col width="30%">
            <col width="70%">
            <thead>
            </thead>
            <tbody>
            <g:each in="${itens}" var="item" status="${i}">
              <tr>
                <td>
                  <input type="hidden"  value="${item.item.id }" name="inscricaoItens.id" >
                  <div id="tit${i}" style="display: ${item?.status == '201' || item?.status == '202' || item?.status == '203' ? 'block': 'none' };">
                    <p style="font-weight: bolder;">
                    N&Atilde;O CONFORME
                  </p>
                  </div>
                  <p>
                  <select NAME="itemStatus"
                          onChange=" if (this.value == '200' || this.value == '201' || this.value == '202' || this.value == '203' ) { document.getElementById('obs${i}').style.display = 'block'; } else { document.getElementById('obs${i}').style.display = 'none';document.getElementById('obs${i}').value = '';};
                           if (this.value == '201' || this.value == '202' || this.value == '203' ) { document.getElementById('tit${i}').style.display = 'block'; } else { document.getElementById('tit${i}').style.display = 'none'};

                          "
                          >
                    <option VALUE="999" ${item?.status == "999" ? "selected ='selected'" : null  } > </option>
                    <option VALUE="100" ${item?.status == '100' ? "selected ='selected'" : null  } >SIM</option>
                    <option VALUE="200" ${item?.status == '200' ? "selected ='selected'" : null  } >N&Atilde;O</option>
                    <OPTGROUP  LABEL="N&Atilde;O CONFORME">
                      <option VALUE="201" ${item?.status == '201' ? "selected ='selected'" : null  } >INCOMPLETO</option>
                      <option VALUE="202" ${item?.status == '202' ? "selected ='selected'" : null  } >VENCIDO</option>
                      <option VALUE="203" ${item?.status == '203' ? "selected ='selected'" : null  } >N&Atilde;O COMPROBAT&Oacute;RIO</option>
                    </OPTGROUP>
                  </select>
                  </p>
                  <br>
                  <p>
                  <div id="obs${i}" style="display: ${item?.status == '200' || item?.status == '201' || item?.status == '202' || item?.status == '203' ? 'block': 'none' };">
                    <label for="itemObs" style="font-weight: bolder;" >Observa&ccedil;&atilde;o</label>
                    <textarea type="text" rows="5"  name="itemObs" > ${item?.obs}</textarea>
                  </div>
                  </p>
                </td>
                <td>
${item?.item?.letra}) ${item?.item?.descricao}
           
              </td>
              </tr>
            </g:each>
            </tbody>
            <script type="text/javascript">
              function ativaObs(i,valor) {
              }
            </script>
          </table>
        </fieldset>
        <fieldset>
          <legend>Outras Observa&ccedil;&etilde;es:</legend>
          <textarea name="obs" cols="30" rows="5" style="width: 480px"   id="obs"  >${inscricaoInstanceAcompanhamento?.obs}
          </textarea>
        </fieldset>
        <div class="spacer"></div><!-- end .spacer -->

        <g:ifAnyGranted role="ROLE_USER_SUPER" >
        <div class="row" id="email${indexador}" >
          <div class="col_2" style="width: 90px;" >
            <input type="submit"   value="Salvar" class="cmd green save"/>
          </div>
          <div class="col_2">
            <button onClick="${remoteFunction(controller:'inscricao',action:'blank', update:[success:'corpo' +indexador] )}"  style="background-color: green;color :white" >Cancelar</button>
          </div>
        </div>
        </g:ifAnyGranted>
        <div class="spacer"></div><!-- end .spacer -->
      </g:formRemote>
    </div>
  </div>
</div>
</div>
</g:ifAnyGranted>
</body>
</html>

